fix(cloudflare,deno): Remove false-positive text/plain streaming classification#20210
Closed
fix(cloudflare,deno): Remove false-positive text/plain streaming classification#20210
Conversation
…lassification
The `classifyResponseStreaming` function classified `text/plain` responses
without a `Content-Length` header as streaming. This heuristic was too
aggressive because `new Response('some text')` creates a `text/plain`
response without Content-Length, causing simple non-streaming responses
to take the streaming code path.
In the streaming path, the span end and transaction flush are delayed
until a stream monitor completes, which can cause timing issues when
the response is passed between Durable Objects and Workers in the
Cloudflare runtime, leading to flaky test timeouts.
Removing this rule ensures simple text/plain responses are processed
through the non-streaming (immediate span end + flush) code path.
Known streaming content types (SSE, NDJSON, JSON streaming) are still
correctly detected.
Fixes #20209
Co-Authored-By: Claude <noreply@anthropic.com>
Agent-Logs-Url: https://github.com/getsentry/sentry-javascript/sessions/b58267a8-c6d6-4fc0-b4fb-82b5843bbf70
Co-authored-by: Lms24 <8420481+Lms24@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Investigate cloudflare workers entrypoint test flakiness
fix(cloudflare,deno): Remove false-positive text/plain streaming classification
Apr 10, 2026
Member
|
surfaced via #20209 |
Contributor
Semver Impact of This PR🟢 Patch (bug fixes) 📋 Changelog PreviewThis is how your changes will appear in the changelog. New Features ✨Core
Deps
Other
Bug Fixes 🐛
Internal Changes 🔧Deps
Other
🤖 This preview updates automatically when you update the PR. |
Contributor
size-limit report 📦
|
Member
|
I'm a bit suspicious about this. not sure if this could really prolong a span for 30s+. |
Member
|
nah that sounds a bit esoteric. Don'T think this would account for 30s delays |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
classifyResponseStreamingclassifiedtext/plainwithoutContent-Lengthas streaming. Sincenew Response('any string')auto-setstext/plain;charset=UTF-8withoutContent-Length, every simple text response hit the streaming code path — tee + monitor stream + deferred span end/flush instead of immediate span end/flush.This caused flaky timeouts in the Cloudflare WorkerEntrypoint E2E test: the Durable Object's
new Response('Stored')was misclassified as streaming, deferring the transaction flush through a chain of tee operations between DO and Worker contexts. Under load (test:prod run), the deferred flush occasionally didn't complete within the 30s test timeout.Changes
packages/cloudflare/src/utils/streaming.ts: Remove thetext/plainwithoutContent-Lengthheuristic. Only known streaming content types remain:text/event-stream,application/ndjson,application/stream+json.packages/deno/src/utils/streaming.ts: Same fix for consistency (identical classification logic).Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
dl.deno.land/usr/bin/curl curl -s REDACTED git fetc�� origin develop ndor/bin/bash(dns block)dsn.ingest.sentry.io/opt/hostedtoolcache/node/24.14.1/x64/bin/node /opt/hostedtoolcache/node/24.14.1/x64/bin/node --conditions node --conditions development /home/REDACTED/work/sentry-javascript/sentry-javascript/node_modules/vitest/node_modules/tinypool/dist/entry/process.js --local es/.bin/run-s user.email(dns block)/opt/hostedtoolcache/node/24.14.1/x64/bin/node /opt/hostedtoolcache/node/24.14.1/x64/bin/node --conditions node --conditions development /home/REDACTED/work/sentry-javascript/sentry-javascript/node_modules/vitest/node_modules/tinypool/dist/entry/process.js --local '~E_ALL' committer.email all("session") as $k => $v) echo/proc/cpuinfo(dns block)/opt/hostedtoolcache/node/24.14.1/x64/bin/node /opt/hostedtoolcache/node/24.14.1/x64/bin/node --conditions node --conditions development /home/REDACTED/work/sentry-javascript/sentry-javascript/node_modules/vitest/node_modules/tinypool/dist/entry/process.js --local de/node/bin/node gpg.program(dns block)fastdl.mongodb.org/opt/hostedtoolcache/node/24.14.1/x64/bin/node /opt/hostedtoolcache/node/24.14.1/x64/bin/node ./postinstall.js(dns block)If you need me to access, download, or install something from one of these locations, you can either: